<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/pageRc/common/common.jsp"%>
<%-- <%@taglib url="http://java.sun.com/jsp/jstl/core" prefix="c" %> --%>
<!DOCTYPE html>
<html lang="en" style="overflow-x: hidden">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no">

<link rel="stylesheet" href="<%=commonPath%>/pageRc/layui/css/layui.css"
	media="all">
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/utils.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/common/msgTool.js"></script>
<script type="text/javascript"
	src="<%=commonPath%>/pageRc/layui/layui.js"></script>
	<script type="text/javascript"
	src="<%=commonPath %>/pageRc/My97DatePicker/WdatePicker.js"></script>
<title>监控表管理</title>
<style>
.Wdate {
    border: #efefef 1px solid;
    height: 35px;
    width: 190px;
    background: #ffffff url(datePicker.gif) no-repeat right;
}
</style>
<script>
	$(function(){

 	})
	//注意：选项卡 依赖 element 模块，否则无法进行工能性操作
	layui.use('element', function() {
		var element = layui.element();

		//…
	});
	$(document).ready(function(){
		$("#datePicker1").empty().html('<input type="text" id="months" name="month" class="Wdate" placeholder="月份" onClick="WdatePicker({months:\'%y-%M\',dateFmt:\'yyyyMM\'})"/>');
});
</script>
<jsp:include page="publicMethod.jsp" />
</head>
<body class="layui-main" style="width: 100%;">
	<blockquote class="layui-elem-quote">监控表</blockquote>
	<form id="createMsgForm" name="createMsgForm" class="layui-form"
			action="">
		<div class="layui-form-item">
			<div class="layui-inline">
				<div class="layui-inline">
					<select name="proGroupNo" id="proGroupNo"
						lay-filter="proGroupSelect" style="width: 210;">
						<option value="">全部</option>
						<c:forEach items="${groupList}" var="group">
							<option value="${group.proGroupNo}">${group.proGroupName}</option>
						</c:forEach>
						<option value="">全部</option>
					</select>
				</div>
				<div class="layui-inline">
					<select name="proTeamNo" id="proTeamNo" style="width: 210;">
						<option value="">项目组名称</option>
						<option value="">全部</option>
						<c:forEach items="${teanList}" var="tean">
							<option value="${tean.proTeamNo}">${tean.proTeamName}</option>
						</c:forEach>
					</select>
				</div>
				<div class="layui-inline">-</div>
				<div class="layui-inline">
					<button class="layui-btn" type="button" data-method="doSearchSum"
						id="doSearchSum">查询</button>
						<button class="layui-btn" type="button" data-method="doExcel">excel下载</button>
				</div>

			</div>
		</div>


		<div class="layui-form-item">
			<div class="layui-inline">
				<div class="layui-inline">
					<input class="layui-input" id="needName" placeholder="需求名称">
				</div>
				<div class="layui-inline">
					<input class="layui-input" id="needNo" placeholder="需求编号">
				</div>
				 <div class="layui-inline">
		       <!-- <div class="layui-input-inline">
					<select name="months" id="months" style="width: 210;">
					    <option value=""></option>
						<option value="1月份">1月份</option>
						<option value="2月份">2月份</option>
						<option value="3月份">3月份</option>
						<option value="4月份">4月份</option>
						<option value="5月份">5月份</option>
						<option value="6月份">6月份</option>
						<option value="7月份">7月份</option>
						<option value="8月份">8月份</option>
						<option value="9月份">9月份</option>
						<option value="10月份">10月份</option>
						<option value="11月份">11月份</option>
						<option value="12月份">12月份</option>
					</select>
				</div> -->
				<div id="datePicker1" class="layui-input-inline">
			                <input type="text" id="months" name="month" class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="需求名称"/>
		                   </div>
		</div>
			</div>
		</div>

		<div class="layui-tab">
			<ul class="layui-tab-title">
			     <li class="layui-this" data-method="doSearchSum"
						id="doSearchSum">软件部汇总表</li>
			     <li class="" data-method="doSearchSum1"
						id="doSearchSum1">各团队汇总表</li>
				<li class="" data-method="doSearchSum2"
						id="doSearchSum2">各团队明细表</li>
			</ul>

			<div class="layui-tab-content">
				<div class="layui-tab-item layui-show">
				<div class="layui-form-item" id="dateDiv1">
					<div class="layui-inline">
						<table class="layui-table" lay-even="" lay-skin="line"
							style="text-align: center; width: 100%;">
							<colgroup align="center">
								<col width="15%">
								<col width="15%">
								<col width="15%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
							</colgroup>
							<thead>
								<tr>
									<th>团队</th>
									<th>月份</th>
									<th>营收目标(万元)</th>
									<th>已完成(万元)</th>
									<th>已评估未上线(万元)</th>
									<th>差额(万元)</th>
									<th>月估计还能完成(万元)</th>
									<th>已立项(万元)</th>
									<th>已下任务单(万元)</th>
									<th>未立项(个数)</th>
								</tr>
							</thead>
							<tbody id="detailDiv1">

							</tbody>
							<script id="tplSrc1" type="text/html">
							 {{#  layui.each(d.body, function(index, x){}}
							     <tr align="left">
								    <td>{{x.proGroupName==undefined?'':x.proGroupName}}</td>
								    <td>{{x.months==undefined?'':x.months}}</td>
									<td>{{x.goal==undefined?'':x.goal}}</td>
								    <td>{{x.ysx==undefined?'':x.ysx}}</td>
									<td></td>
									<td>{{x.balance==undefined?'':x.balance<0?'0':x.balance}}</td>
									<td></td>
								 	<td></td>
 									<td></td>
			 						<td></td>
 							    </tr>
							{{#  }); }} 
					   </script>
						</table>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<div id="laypageDiv1"></div>
						</div>
					</div>
				</div>

			<div class="layui-tab-item">
				<div class="layui-form-item" id="dateDiv2">
					<div class="layui-inline">
						<table class="layui-table" lay-even="" lay-skin="line"
							style="text-align: center; width: 100%;">
							<colgroup align="center">
								<col width="15%">
								<col width="15%">
								<col width="15%">
								<col width="15%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
								<col width="10%">
							</colgroup>
							<thead>
								<tr>
									<th>团队</th>
									<th>已下任务单(万元)</th>
									<th>已立项(万元)</th>
									<th>未立项个数</th>
									<th>已过规划评审(万元)</th>
									<th>已上线(万元)</th>
									<th>已上线下任务单(万元)</th>
									<th>已上线无任务单(万元)</th>
								</tr>
							</thead>
							<tbody id="detailDiv2">

							</tbody>
							<script id="tplSrc2" type="text/html">
							 {{#  layui.each(d.body, function(index, x){}}
							     <tr align="left">
								   <td>{{x.proGroupName==undefined?'':x.proGroupName}}</td>
								   <td>{{x.yxrw==undefined?'':x.yxrw}}</td>
									<td>{{x.ylx==undefined?'':x.ylx}}</td>
								    <td>{{x.wlx==undefined?'':x.wlx}}</td>
									<td>{{x.yggh==undefined?'':x.yggh}}</td>
									<td>{{x.ysx==undefined?'':x.ysx}}</td>
									<td>{{x.ysxx==undefined?'':x.ysxx}}</td>
								    <td>{{x.ysxw==undefined?'':x.ysxw<0?'0':x.ysxw}}</td>
 							    </tr>
							{{#  }); }} 
					   </script>
						</table>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-inline">
						<div id="laypageDiv2"></div>
					</div>
				</div>
			</div>

			<div class="layui-tab-item">
				<div class="layui-form-item" id="dateDiv3">
						<div class="layui-inline">
							<table class="layui-table" lay-even="" lay-skin="line"
								style="text-align: center; width: 100%;">
								<colgroup align="center">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="10%">
									<col width="10%">
									<col width="10%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
									<col width="15%">
								</colgroup>
								<thead>
									<tr>
										<th>团队</th>
										<th>需求编号</th>
										<th>需求名称</th>
										<th>公司项目经理</th>
										<th>行方项目经理</th>
										<th>行方业务人员</th>
										<th>公司参与人员</th>
										<th>需求阶段</th>
										<th>规划状态</th>
										<th>开始日期</th>
										<th>上线日期</th>
										<th>月份</th>
										<th>评估工时</th>
										<th>实际消耗人天</th>
										<th>截止到上周投入人天</th>
										<th>本周投入人天</th>
										<th>是否预警</th>
										<th>每日问题反馈</th>
										<th>合同批次</th>
										<%-- <th>操作</th>--%>
									</tr>
								</thead>
								<tbody id="detailDiv3">

								</tbody>
								<script id="tplSrc3" type="text/html">
							 {{#  layui.each(d.needList, function(index, x){}}
							     <tr align="left">
                                    <td>{{x.proGroupName==undefined?'':x.proGroupName}}</td>
								    <td>{{x.needNo==undefined?'':x.needNo}}</td>													
								    <td>{{x.needName==undefined?'':x.needName}}</td>
                                  	<td>{{x.teamManger==undefined?'':x.teamManger}}</td>
									<td>{{x.hfjl==undefined?'':x.hfjl}}</td>
									<td>{{x.hfywry==undefined?'':x.hfywry}}</td>
				 					<td>{{x.gscyry==undefined?'':x.gscyry}}</td>
                                    <td>{{x.state==undefined?'':x.state=='01'?'正常':'需求关闭'}}</td>
									<td>{{x.planStatus==undefined?'':x.planStatus}}</td>
									<td>{{x.createDate==undefined?'':x.createDate}}</td>
									<td>{{x.dateOfLine==undefined?'':x.dateOfLine}}</td>
									<td>{{x.months==undefined?'':x.months}}</td>
									<td>{{x.needTime==undefined?'':x.needTime}}</td>
									<td>{{x.sjxhrt==undefined?'':x.sjxhrt}}</td>
								    <td>{{x.lastweek==undefined?'':x.lastweek}}</td>
									<td>{{x.weekRt==undefined?'':x.weekRt}}</td>
                                    <td></td>
                                    <td></td>
                                    <td>{{x.contractApproval==undefined?'':x.contractApproval}}</td>
									<%--<td><button class="layui-btn" type="button" onclick="updateNeedInfor('{{x.rouid}}')">更新</button></td>--%>
 							    </tr>
							{{#  }); }} 
					   </script>
							</table>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-inline">
							<div id="laypageDiv3"></div>
					</div>
				</div>
			</div>
			</div>
			</div>
	</form>
	<input id="totalNum" type="hidden" name="totalNum" >
</body>
<script type="text/javascript">
var path="<%=commonPath%>";
	var msg = new msgTool();
	layui.use([ 'form', 'layer', 'laytpl', 'laypage', 'laydate' ],
	function() {
	var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
	var form = layui.form(), layer = layui.layer, laypage = layui.laypage, laytpl = layui.laytpl;
	var active = {
		doSearchSum : function() { //搜索
			var getTpl1 = tplSrc1.innerHTML;
			var dataObj = {
				"proTeamNo" : $("#proTeamNo").val(),
				"proGroupNo":$("#proGroupNo").val(),
				"needNo" : $("#needNo").val(),
				"needName" : $("#needName").val(),
				"months" : $("#months").val()
			}
			msg.sendMsg("/page/need/SelectSoftwareSummary.do",
				dataObj,function(data) {
				console.log();
				laytpl(getTpl1).render(data,function(html) {
					detailDiv1.innerHTML = html;
				});
					});
		},
		
		doSearchSum1 : function() { //搜索
			var getTpl2 = tplSrc2.innerHTML;
			var dataObj2 = {
				"proTeamNo" : $("#proTeamNo").val(),
				"proGroupNo":$("#proGroupNo").val(),
				"needNo" : $("#needNo").val(),
				"needName" : $("#needName").val()
			}
			msg.sendMsg("/page/need/SelectBankSummary.do",
				dataObj2,function(data) {
				console.log();
				laytpl(getTpl2).render(data,function(html) {
					detailDiv2.innerHTML = html;
				});
					});
		},
		
		
		
		doSearchSum2:function(){   //搜索
      	  active.doSearchDetail(1); 
         }
         ,doSearchDetail:function(v_curr){ //搜索
        if(v_curr==1){
      	    var getTpl3 = tplSrc3.innerHTML;
  			var dataObj3 = {
  						"startRow" : (v_curr-1)*5,
  						"pageSize" : 5,
  						"proTeamNo" : $("#proTeamNo").val(),
  						"proGroupNo":$("#proGroupNo").val(),
  						"needNo" : $("#needNo").val(),
  						"needName" : $("#needName").val(),
  						"months" : $("#months").val()
  					};
  			msg.sendMsg("/page/need/SelectBankResolve.do",dataObj3,function(data) {
  				laytpl(getTpl3).render(data.body,function(html) {
  				    detailDiv3.innerHTML = html;
  					$('#totalNum').val(data.body.count)
  				});
  				totalNum = Math.ceil(data.body.count/5);
  				laypage({
	                   cont: 'laypageDiv3'
	                 ,pages:totalNum
	                  ,jump: function(obj,first){
	                	  if(first!=true){
	                	  	active.doSearchDetail(obj.curr); 
	                	  }
	                   }
	                 }); 
  			}); 
         }else{
        	 var getTpl3 = tplSrc3.innerHTML;
   			var dataObj3 = {
   						"startRow" : (v_curr-1)*5,
   						"pageSize" : 5,
   						"proTeamNo" : $("#proTeamNo").val(),
   						"proGroupNo":$("#proGroupNo").val(),
   						"needNo" : $("#needNo").val(),
   						"needName" : $("#needName").val(),
   						"months" : $("#months").val()
   					};
   			msg.sendMsg("/page/need/SelectBankResolve.do",dataObj3,function(data) {
   				laytpl(getTpl3).render(data.body,function(html) {
   				    detailDiv3.innerHTML = html;
   					$('#totalNum').val(data.body.count)
   				});
   			}); 
         }
         }, 
		
		
		
		
	 	/* doSearchSum2 : function() { //搜索
			var getTpl3 = tplSrc3.innerHTML;
			var dataObj3 = {
				"proTeamNo" : $("#proTeamNo").val(),
				"proGroupNo":$("#proGroupNo").val(),
				"needNo" : $("#needNo").val(),
				"needName" : $("#needName").val()
			}
			msg.sendMsg("/page/need/SelectBankResolve.do",
				dataObj3,function(data) {
				console.log();
				laytpl(getTpl3).render(data,function(html) {
					detailDiv3.innerHTML = html;
				});
					});
		}, */
							

	
	doExcel : function() {
		debugger;
		var dataObj = {
			"proGroupNo" : $("#proGroupNo").val(),
			"proTeamNo" : $("#proTeamNo").val(),
			"needNo" : $("#needNo").val(),
			"needName" : $("#needName").val(),
			"months" : $("#months").val()
		}
		msg.sendMsg("/page/main/JianKongLoad.do",
				dataObj, function(data) {
			window.location.href = path
			+ "/downFile/"
			+ data.body.fileName
});
},
	
	}
		
						
	/* $("#doexcle").click(function(){
				$("#createMsgForm").submit();		
						}); */
						
						
						
	$('.layui-btn').on('click',function() {
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this,othis) : '';
	});
	$('.layui-tab-title li').on('click',function() {
		var othis = $(this), method = othis.data('method');
		active[method] ? active[method].call(this,othis) : '';
	});
});
	 function flush(){
	        $('#doSearchSum').click();
	    }
	 function updateNeedInfor(rouid) {
	        layer.open({
	            type: 2,
	            title:"需求更新",
	            area: ['80%', '70%'],
	            scrollbar: false,
	            content: '<%=commonPath%>/page/need/' + rouid+ '/doUpdateJianKong.do',
			success : function(layero, index) {
			},
			end : function() {
				flush();
			}
		});
	}
	function reStartNeedInfor(rouid) {
		var jsonDate = {};
		jsonDate.rouid = rouid;
		msg.sendMsg("/page/base/reStartNeedInfor.do", jsonDate, function(data) {
			var rsObj = null;
			if (msg.isJson(data)) {
				rsObj = data
			} else {
				rsObj = JSON.parse(data);
			}
			var retCode = rsObj.head.retCode;
			if (retCode !== '0000') {
				layer.alert("打开失败！");
			} else {
				flush();
				layer.alert("打开成功！");
			}
		});
	}
</script>

</html>